[http-client-csharp] Add SSE protocol Spector scenarios - #11921
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Upgrade all TypeSpec and Azure toolchain dependencies and matching peer declarations to the stable September releases. Keep SSE customizations and scenario generation out of the dependency PR. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Support namespace-qualified CodeGenType mappings, preserve used customization attributes in stubs, and regenerate fixtures for the full TypeSpec upgrade. Keep streaming scenario tests in their separate PR. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Revert 422b45e from this branch; the shared model rename is maintained independently in microsoft#11920. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Merge approved dependency baseline 3d9a081 from microsoft#11918. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
commit: |
|
No changes needing a change description found. |
There was a problem hiding this comment.
🟡 Changes recommended
The new stub-library “used customization attribute” detection compares minimally-qualified Roslyn names against fully-qualified provider names, which can cause required attributes to be incorrectly dropped.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates the http-client-csharp TypeSpec dependency set and expands Spector coverage for SSE “protocol” scenarios, while also enhancing the generator’s customization handling (qualified-name matching) and stub-library pruning of unused customization attributes.
Changes:
- Bump TypeSpec/Azure Tools dependencies for
http-client-csharpand refresh Spector fixture outputs accordingly. - Add seven missing SSE protocol Spector tests (envelope/no-envelope, id/retry validation, and reconnect via
Last-Event-ID). - Prefer qualified
CodeGenTypenames during customization lookups and add tests for qualified-name model/enum customization; refine stub generation to drop unused customization attribute definitions.
File summaries
| File | Description |
|---|---|
| packages/http-client-csharp/package.json | Updates peer/dev dependency versions for the emitter toolchain. |
| packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/sse/tspCodeModel.json | Regenerated SSE Spector code model reflecting new protocol surface. |
| packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/sse/src/Generated/StreamingSseModelFactory.cs | Regenerated model factory with protocol model support. |
| packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/sse/src/Generated/SseClient.cs | Regenerated client to expose GetProtocolClient(). |
| packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/sse/src/Generated/ProtocolData.cs | New generated protocol data client for envelope/no-envelope scenarios. |
| packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/sse/src/Generated/Protocol.cs | New generated protocol client for id/retry/reconnect scenarios. |
| packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/sse/src/Generated/Models/StreamingSseContext.cs | Registers ProtocolInfo for MRW buildable context. |
| packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/sse/src/Generated/Models/ProtocolInfo.Serialization.cs | New generated serialization for ProtocolInfo. |
| packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/sse/src/Generated/Models/ProtocolInfo.cs | New generated model type for protocol event payloads. |
| packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/sse/src/Generated/Internal/CodeGenTypeAttribute.cs | Generated customization attribute definition for fixture compilation. |
| packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/sse/src/Custom/ProtocolInfo.cs | Customization to rename protocol Info to ProtocolInfo. |
| packages/http-client-csharp/generator/TestProjects/Spector/http/response/body-or-no-content/tspCodeModel.json | New/updated Spector code model for response “body or no content” fixture. |
| packages/http-client-csharp/generator/TestProjects/Spector/http/response/body-or-no-content/src/Response.BodyOrNoContent.csproj | Adds new Spector fixture project definition. |
| packages/http-client-csharp/generator/TestProjects/Spector/http/response/body-or-no-content/src/Generated/schema/ConfigurationSchema.json | Adds generated configuration schema for the new fixture. |
| packages/http-client-csharp/generator/TestProjects/Spector/http/response/body-or-no-content/src/Generated/ResponseBodyOrNoContentModelFactory.cs | Adds generated model factory for the new fixture. |
| packages/http-client-csharp/generator/TestProjects/Spector/http/response/body-or-no-content/src/Generated/Models/ResponseBodyOrNoContentContext.cs | Adds MRW context for fixture models. |
| packages/http-client-csharp/generator/TestProjects/Spector/http/response/body-or-no-content/src/Generated/Models/BlobLayout.Serialization.cs | Adds generated serialization for BlobLayout. |
| packages/http-client-csharp/generator/TestProjects/Spector/http/response/body-or-no-content/src/Generated/Models/BlobLayout.cs | Adds generated model BlobLayout. |
| packages/http-client-csharp/generator/TestProjects/Spector/http/response/body-or-no-content/src/Generated/BodyOrNoContentClientSettings.cs | Adds generated settings type for the new fixture client. |
| packages/http-client-csharp/generator/TestProjects/Spector/http/response/body-or-no-content/src/Generated/BodyOrNoContentClientOptions.cs | Adds generated options type for the new fixture client. |
| packages/http-client-csharp/generator/TestProjects/Spector/http/response/body-or-no-content/src/Generated/BodyOrNoContentClient.cs | Adds generated client for “body or no content” operations. |
| packages/http-client-csharp/generator/TestProjects/Spector/http/response/body-or-no-content/Response.BodyOrNoContent.slnx | Adds solution entry for the new fixture. |
| packages/http-client-csharp/generator/TestProjects/Spector/http/response/body-or-no-content/Response.BodyOrNoContent.NuGet.targets | Adds targets for configuration schema packing/consumption. |
| packages/http-client-csharp/generator/TestProjects/Spector/http/response/body-or-no-content/Configuration.json | Adds generator configuration for the new fixture. |
| packages/http-client-csharp/generator/TestProjects/Spector.Tests/Http/Streaming/Sse/SseTests.cs | Adds seven SSE protocol Spector scenarios and a single-event reader helper. |
| packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/test/Providers/ModelProviders/TestData/ModelCustomizationTests/QualifiedNameOverridesSimpleName/CustomModels.cs | Test data for qualified vs simple customization precedence. |
| packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/test/Providers/ModelProviders/TestData/ModelCustomizationTests/CanRenameModelsByQualifiedNames/CustomModels.cs | Test data for renaming multiple same-named models by qualified names. |
| packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/test/Providers/ModelProviders/TestData/ModelCustomizationTests/CanRenameModelByQualifiedName/ProtocolInfo.cs | Test data for single qualified-name rename. |
| packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/test/Providers/ModelProviders/TestData/ModelCustomizationTests/CanRenameEnumByQualifiedName/FirstStatus.cs | Test data for qualified-name enum rename. |
| packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/test/Providers/ModelProviders/ModelCustomizationTests.cs | Adds unit tests validating qualified-name customization behavior. |
| packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/SourceInput/SourceInputModel.cs | Prefers qualified CodeGenType names when resolving customization types. |
| packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Properties/launchSettings.json | Adds a launch profile for the new Spector fixture. |
| packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/TestData/InputLibraryVisitorTests/StubKeepsUsedCustomizationAttributes/Model.cs | Test data to ensure stub keeps attributes when directly used. |
| packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/TestData/InputLibraryVisitorTests/StubKeepsInheritedCustomizationAttributes/Model.cs | Test data to ensure stub keeps base attributes for derived usage. |
| packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Microsoft.TypeSpec.Generator.ClientModel.Tests.csproj | Adds stub-library project reference needed by new tests. |
| packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/InputLibraryVisitorTests.cs | Adds tests verifying unused customization attributes are dropped/kept appropriately. |
| packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel.StubLibrary/src/StubLibraryVisitor.cs | Implements detection of which customization attributes are used by custom code. |
Review details
- Files reviewed: 21/38 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…on workaround Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Merge the finalized dependency upgrade with HTTP specs 0.1.0-alpha.43 and native SSE model names. Preserve the existing seven protocol scenario tests. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
The new WithEnvelope SSE test likely asserts the wrong payload shape and should parse/assert the JSON contents field to match the modeled event payload.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 9/25 changed files
- Comments generated: 1
- Review effort level: Lite
Merge Microsoft main after the dependency upgrade in microsoft#11918. Keep the PR limited to the seven SSE protocol scenario tests. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Summary
Add the seven missing SSE protocol Spector tests:
WithEnvelope,WithoutEnvelope,Id,InvalidId,Retry,InvalidRetry, andReconnect. Assert exact event counts, types, and payloads, preserve valid metadata, and ignore invalid ID/retry metadata. Reconnect is explicit usingRequestOptions: sendLast-Event-IDfrom the first event, then assert resumed event 2.The diff against
mainis onlySseTests.cs(+109 lines). Existing JSONL and basic SSE tests are unchanged. This PR adds no generator, dependency, or TypeSpec customization changes.#11918 has merged, and this branch is synchronized with Microsoft
mainat9b8c51de8c15b6dc748ea9cf576d87f91ef058c4. It uses the pinned@typespec/http-specs0.1.0-alpha.43and native unique SSE model names from #11920, without the temporary naming workaround.Validation
main, and no temporary C# customization or generated stubCodeGenTypeAttributeremains.